home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / e-lang / realgaug.lha / Gauge_Test.e < prev    next >
Text File  |  1996-02-02  |  3KB  |  91 lines

  1. /*
  2.     PROGRAM  : Gauge_Test - trying out a *real good* gauge module...
  3.     LANGUAGE : E
  4.     AUTHOR   : Daniel `ThunderPig` Rädel/NEUDELSoft (-DR-/NS)
  5.     DATE     : 040596
  6.     xxx-WARE : This source is `Public Domain` :)
  7. */
  8.  
  9. OPT OSVERSION=37 -> sorry - everything else is obsolete...
  10.  
  11. MODULE  'tools/easygui','gadtools','libraries/gadtools','tools/exceptions',
  12.         'intuition/intuition','utility','plugins/gauge'
  13.  
  14.     DEF gauge:PTR TO gauge_bar, gui=0:PTR TO guihandle,
  15.         gauge2:PTR TO gauge_bar, gauge3:PTR TO gauge_bar,
  16.         gauge4:PTR TO gauge_bar, gauge5:PTR TO gauge_bar,
  17.         gauge6:PTR TO gauge_bar
  18.  
  19. PROC main() HANDLE
  20.  
  21.     IF (gadtoolsbase:=OpenLibrary('gadtools.library',0))
  22.  
  23.         -> This lib is needed by the module (GetTagData()...)
  24.         IF (utilitybase:=OpenLibrary('utility.library',0))
  25.  
  26.     -> Opening an `easygui`-window with lots of the new plugins
  27.             gui:=guiinit('Testing the *real* gauge plugin module...', [ROWS, [COLS,
  28.  
  29.             [PLUGIN,0, NEW gauge.init_gauge([GA_IsVertical, TRUE,
  30.               GA_Percentage, TRUE, GA_BackgroundPen, 3,
  31.               GA_IsVolumeSlider, TRUE, 0])],
  32.  
  33.             [PLUGIN, 0, NEW gauge3.init_gauge([GA_Current,100,
  34.               GA_TextLen,9,GA_TextPtr,'Click Me!', GA_BorderRecessed, TRUE,
  35.               GA_Bar3D, TRUE, GA_GaugeUsable, TRUE,
  36.               GA_ActionProc,{testproc}, GA_GaugeID,16,0])] ,
  37.  
  38.             [PLUGIN, 0, NEW gauge4.init_gauge([GA_TextPtr,'and me!',
  39.               GA_TextLen, 7,GA_IsRound, TRUE,GA_GaugeUsable, TRUE,
  40.               GA_GaugeID,42, GA_ActionProc,{testproc},
  41.               GA_Current,100,0])] ,
  42.  
  43.             [PLUGIN, 0, NEW gauge5.init_gauge([GA_BorderRecessed, TRUE,
  44.               GA_IsRound, TRUE,GA_FixedWidth, 120,
  45.               GA_RoundPointerPen, 3,0])] ,
  46.  
  47.             [PLUGIN, 0, NEW gauge6.init_gauge([GA_BarRecessed, TRUE,
  48.             GA_IsVertical, TRUE, GA_Bar3D, TRUE,
  49.             GA_BackgroundPen, 2, GA_BarPen, 1, 0])] ],
  50.  
  51.             [PLUGIN, 0, NEW gauge2.init_gauge([GA_IsVolumeSlider, TRUE,
  52.             GA_TextLen, 9, GA_TextPtr, 'Slide me!', GA_ActionProc, {slider},
  53.             GA_GaugeUsable, TRUE,0])] ])
  54.  
  55.             IF gui
  56.                 -> a simple loop will do in a demo
  57.                 WHILE (guimessage(gui)=-1)
  58.                     WaitTOF()
  59.                 ENDWHILE
  60.             ENDIF
  61.         ENDIF
  62.     ENDIF
  63. EXCEPT DO
  64.     IF gui THEN cleangui(gui)
  65.     IF gadtoolsbase THEN CloseLibrary(gadtoolsbase)
  66.     IF utilitybase THEN CloseLibrary(utilitybase)
  67.  
  68.     -> This is important! There are some structures (24 Bytes :) that are
  69.     -> to be released!
  70.     END gauge
  71.     END gauge2; END gauge3; END gauge4; END gauge5; END gauge6
  72.  
  73.     report_exception()
  74. ENDPROC
  75.  
  76. -> This proc will be called every time you change something at the
  77. -> `Slide me!` titled volume slider
  78. PROC slider(id, cur)
  79.     gauge.setgauge(gui.wnd,cur)
  80.     gauge2.setgauge(gui.wnd,cur)
  81.     gauge5.setgauge(gui.wnd,cur)
  82.     gauge6.setgauge(gui.wnd,cur)
  83. ENDPROC
  84.  
  85. -> and this proc links gauge3 and gauge4 together
  86. PROC testproc(id, cur)
  87.     IF id=42 THEN gauge3.setgauge(gui.wnd, cur) ELSE gauge4.setgauge(gui.wnd, cur)
  88. ENDPROC
  89.  
  90.  
  91.